import T from  'utils/T';

/**
 * 转轮轮播图
 * @param elem
 * @param options
 * @param data
 * @constructor
 */
function Box(elem, options, data) {
    // autoPlay 是否开启自动轮播
    // interval 自动轮播间隔时间
    this.defaults = {
        autoPlay: false,
        interval: 3000,
    }; // 默认配置
    this.opts = $.extend({}, this.defaults, options); // 在jQuery命名空间上增加两个函数
    this.interval = this.opts.interval;
    this.timer = null;
    this.autoPlay = this.opts.autoPlay;
    this.inital();
}

Box.prototype = {
    play: function () {
        if (this.autoPlay) {
            this.initalCarousel();
        }
    },

    // 执行渲染
    initalCarousel: function () {

    },

    inital: function () {
        let self = this;

        this.initalCarousel();

        this.timer = setInterval(function () {
            self.play();
        }, this.interval);
    },

    constructor: Box
};

export default Box;
